Path Class Reference

#include <Path.h>

Inheritance diagram for Path:

TraffEduObject List of all members.

Public Member Functions

 Path ()
 Path (string pathname, float scale)
void draw (osg::ref_ptr< osg::Group > root, int animationFlag=-1)
void deletePart ()
osg::Vec3 calculateCatmull (osg::Vec3 first, osg::Vec3 second, osg::Vec3 third, osg::Vec3 fourth, double fifth)
void setPoints (double number=1.0)
osg::Node * displayLines (void)
osg::Node * displayDots (void)
void addNewPoint (osg::Vec3 first, double number=1.0)
osg::Vec3 * getControlPointVector ()
osg::Vec3 * getPointVector ()
double * getRotationArray ()
void setRotationArray ()
double returnAngle (osg::Vec3d first, osg::Vec3d second)

Private Attributes

osg::Vec3 controlPointArray [MAXCONTROLPOINTS]
osg::Vec3 pointArray [MAXPOINTS]
double rotationArray [MAXPOINTS]
int numControlPoints
int numPoints
int controlPointsIndex
int rotationArrayIndex
osg::Geode * lineGeode
osg::Geometry * lineGeom
osg::Geode * dotGeode
osg::Geometry * dotGeom
osg::Group * lineGroup
osg::Group * dotGroup

Detailed Description

A class to implement one type of TraffEduObject, that is Path.

Definition at line 4 of file Path.h.


Constructor & Destructor Documentation

Path::Path (   ) 
 

A constructor. default constructor.

Definition at line 2 of file Path.cpp.

References controlPointsIndex, dotGeode, dotGeom, dotGroup, lineGeode, lineGeom, lineGroup, numControlPoints, numPoints, and rotationArrayIndex.

Path::Path (  string  pathname,
float  scale
) 
 

A constructor.

Parameters:
pathname string argument defining path name.
scale is a float argument defining scale factor.

Definition at line 14 of file Path.cpp.

References controlPointsIndex, dotGeode, dotGeom, dotGroup, lineGeode, lineGeom, lineGroup, numControlPoints, numPoints, and rotationArrayIndex.


Member Function Documentation

void Path::addNewPoint (  osg::Vec3  first,
double  number = 1.0
) 
 

a normal member taking two arguments .

Parameters:
first one is osg::Vec3.
number is a double.
See also:
setPoints(double number=1.0) adds new control point to the path and calls setPoints

Definition at line 153 of file Path.cpp.

References controlPointArray, displayDots(), displayLines(), numControlPoints, and setPoints().

Referenced by AnimationWindow::createControlPoints().

osg::Vec3 Path::calculateCatmull (  osg::Vec3  first,
osg::Vec3  second,
osg::Vec3  third,
osg::Vec3  fourth,
double  fifth
) 
 

a normal member .

Parameters:
first is an osg::Vec3.
second is an osg::Vec3.
third is an osg::Vec3.
fourth is an osg::Vec3.
fifth is a double.
Returns:
osg::Vec3 Calculates the points on the cutmoll-rom curve,between the given four control points(A,B,C,D) returns the calculated point

Definition at line 30 of file Path.cpp.

Referenced by setPoints().

void Path::deletePart (   ) 
 

a normal member . removes dotGroup and lineGroup from teh root.

Definition at line 170 of file Path.cpp.

References controlPointsIndex, dotGeode, dotGeom, dotGroup, lineGeode, lineGeom, lineGroup, numControlPoints, numPoints, and rotationArrayIndex.

Referenced by Vehicle::deletePath().

osg::Node * Path::displayDots (  void   ) 
 

a normal member .

Returns:
pointer to osg::Node. displays(adds to the scene root) control points of the path

Definition at line 121 of file Path.cpp.

References dotGeode, dotGeom, numPoints, and pointArray.

Referenced by addNewPoint().

osg::Node * Path::displayLines (  void   ) 
 

a normal member .

Returns:
pointer to osg::Node. displays(adds to the scene root) lines of the path

Definition at line 85 of file Path.cpp.

References lineGeode, lineGeom, numPoints, and pointArray.

Referenced by addNewPoint().

void Path::draw (  osg::ref_ptr< osg::Group >  root,
int  animationFlag = -1
)  [virtual]
 

a normal member taking two arguments.

Parameters:
root is an osg::ref_ptr to osg::Group which the model node will be added.
animationFlag is an integer flag to specify whether the root is animation window root or not. this function adds the path geodes and groups to the root.

Implements TraffEduObject.

Definition at line 162 of file Path.cpp.

References TraffEduObject::addTree(), dotGeode, dotGroup, lineGeode, lineGroup, and TraffEduObject::objectPAT.

Referenced by Vehicle::drawPath().

osg::Vec3 * Path::getControlPointVector (   ) 
 

a normal member .

Returns:
osg::Vec3 pointer. returns ControlPoint vector of the path.

Definition at line 192 of file Path.cpp.

References controlPointArray.

osg::Vec3 * Path::getPointVector (   ) 
 

a normal member .

Returns:
osg::Vec3 pointer. returns point vector of the path.

Definition at line 195 of file Path.cpp.

References pointArray.

Referenced by createAnimationPath(), and CarPhysics::mySetPosition().

double * Path::getRotationArray (   ) 
 

a normal member .

Returns:
osg::Vec3 pointer. returns rotation array of the path.

Definition at line 198 of file Path.cpp.

References rotationArray.

Referenced by createAnimationPath().

double Path::returnAngle (  osg::Vec3d  first,
osg::Vec3d  second
) 
 

a normal member .

Parameters:
first an osg::Vec3.
second an osg::Vec3.
Returns:
double Calculates the angle between two given points returns the calculated angle

Definition at line 244 of file Path.cpp.

Referenced by setRotationArray().

void Path::setPoints (  double  number = 1.0  ) 
 

a normal member .

Parameters:
number a double. controlPoints: 0 1 2 3 controlPointsIndex:0 calculates the points between 1 and 2, adds to pointArray changes controlPointsIndex to 1

Definition at line 47 of file Path.cpp.

References calculateCatmull(), controlPointArray, controlPointsIndex, numControlPoints, numPoints, and pointArray.

Referenced by addNewPoint().

void Path::setRotationArray (   ) 
 

a normal member . calls returnAngle for each successive point of the path, and constructs rotation array.

Definition at line 201 of file Path.cpp.

References numPoints, pointArray, returnAngle(), rotationArray, and rotationArrayIndex.

Referenced by AnimationWindow::createRotationArray().


Member Data Documentation

osg::Vec3 Path::controlPointArray[MAXCONTROLPOINTS] [private]
 

Definition at line 7 of file Path.h.

Referenced by addNewPoint(), getControlPointVector(), and setPoints().

int Path::controlPointsIndex [private]
 

Definition at line 12 of file Path.h.

Referenced by deletePart(), Path(), and setPoints().

osg::Geode* Path::dotGeode [private]
 

Definition at line 16 of file Path.h.

Referenced by deletePart(), displayDots(), draw(), and Path().

osg::Geometry* Path::dotGeom [private]
 

Definition at line 17 of file Path.h.

Referenced by deletePart(), displayDots(), and Path().

osg::Group* Path::dotGroup [private]
 

Definition at line 19 of file Path.h.

Referenced by deletePart(), draw(), and Path().

osg::Geode* Path::lineGeode [private]
 

Definition at line 14 of file Path.h.

Referenced by deletePart(), displayLines(), draw(), and Path().

osg::Geometry* Path::lineGeom [private]
 

Definition at line 15 of file Path.h.

Referenced by deletePart(), displayLines(), and Path().

osg::Group* Path::lineGroup [private]
 

Definition at line 18 of file Path.h.

Referenced by deletePart(), draw(), and Path().

int Path::numControlPoints [private]
 

Definition at line 10 of file Path.h.

Referenced by addNewPoint(), deletePart(), Path(), and setPoints().

int Path::numPoints [private]
 

Definition at line 11 of file Path.h.

Referenced by deletePart(), displayDots(), displayLines(), Path(), setPoints(), and setRotationArray().

osg::Vec3 Path::pointArray[MAXPOINTS] [private]
 

Definition at line 8 of file Path.h.

Referenced by displayDots(), displayLines(), getPointVector(), setPoints(), and setRotationArray().

double Path::rotationArray[MAXPOINTS] [private]
 

Definition at line 9 of file Path.h.

Referenced by getRotationArray(), and setRotationArray().

int Path::rotationArrayIndex [private]
 

Definition at line 13 of file Path.h.

Referenced by deletePart(), Path(), and setRotationArray().


The documentation for this class was generated from the following files:
Generated on Sun May 28 18:54:14 2006 for TraffEdu by  doxygen 1.4.6-NO